package ooday03;

public class ReArrayDemo {
    public static void main(String[] args) {
        Dog [] dogs = new Dog[3];
        dogs[0] = new Dog("肥宅","黑",6);
        dogs[1] = new Dog("崽崽","白",2);
        dogs[2] = new Dog("豆花","白",4);
        for (int i = 0 ; i < dogs.length ; i++){
            System.out.println(dogs[i].name);
            dogs[i].eat();
        }
        Chick [] chicks = new Chick[2];
        chicks[0] = new Chick("小黄","黄",4);
        chicks[1] = new Chick("小白","白",2);
        for (int i = 0 ; i < chicks.length ; i++){
            System.out.println(chicks[i].name);
            chicks[i].layEggs();
        }
        Fish [] fish = new Fish[4];
        fish[0] = new Fish("小蓝","蓝",1);
        fish[1] = new Fish("小绿","绿",2);
        fish[2] = new Fish("小金","金",3);
        fish[3] = new Fish("小红","红",4);
        for (int i = 0 ; i < fish.length ; i++){
            System.out.println(fish[i].color);
            fish[i].swim();
        }
        }

    }

